import request from '@/utils/request';

/**
 * 预约记录API
 */

// 分页查询预约列表
export const getReservationListAPI = (params) => {
  return request({
    url: '/reservation/list',
    method: 'get',
    params
  });
};

// 获取预约详细信息
export const getReservationInfoAPI = (id) => {
  return request({
    url: `/reservation/${id}`,
    method: 'get'
  });
};


// 修改预约
export const updateReservationAPI = (reservationData) => {
  return request({
    url: '/reservation',
    method: 'put',
    data: reservationData
  });
};

// 删除预约
export const deleteReservationAPI = (ids) => {
  return request({
    url: '/reservation/' + ids.join(','),
    method: 'delete'
  });
};

// 管理员审核预约
export const reviewReservationAPI = (data) => {
    console.log(data);
    
  return request({
    url: `/reservation/review/${data.id}`,
    method: 'put',
    params: {  
      approved: data.approved,
      reason: data.reason
    }
  });
};

